<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  class MySet {
    #items = {}

    constructor(val) {
      if (val && Array.isArray(val)) {
        for (let i = 0; i < val.length; i ++) {
          this.add(val[i])
        }
      }
    }

    // get size () {
    //   return Object.keys(this.#items).length
    // }

    add (val) {
      if (!this.has(val)) {
        this.#items[val] = val
        return true
      }
      return false
    }

    has (val) {
      return val in this.#items
    }

    delete (val) {
      if (this.has(val)) {
        delete this.#items[val]
        return true
      }
      return false
    }

    clear () {
      this.#items = {}
    }

    size () {
      return Object.keys(this.#items).length
    }

    values () {
      return Object.values(this.#items)
    }
  }

  const mySet = new MySet([1, 2, 3, 3, 4, 5])

  const set = new Set([1, 2, 3, 3, 4, 5])
</script>
</body>
</html>
